<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="css/common.css" type="text/css">
</head>
<body>
    <div id="app">
        
        <!-- <img v-bind:src="imgUrl">
        
        <a v-bind:href="Url">百度一下</a>
        <div :class="clsProp">
            <font class="color">tttttttttttttttttttttt</font>
            <h1>张杰</h1> -->
            <!-- <p v-if="age===18">我十八岁</p>
            <p v-else-if="age===58">我不再当年</p>
            <p v-else>你还是从前那个少年</p>
            <template v-if="age===18">
                <p>你很好</p>
            </template>
            <template v-else-if="age===58">
                <p>我不配</p>
            </template>
            <template v-else">
                <p>忘了我吧，下一位</p>
            </template> -->

            <ul>
                <li v-for="f in friuts">{{f.name}}--{{f.price}}</li>
            </ul>
            <ul>
                <template v-for="friuts in filterFriuts">
                    <li>水果名称:{{friuts.name}}</li>
                    <li>水果价格:{{friuts.price}}</li>
                </template>
            </ul>
            <ul>
                <template v-for="friuts in priceFriuts">
                    <li>水果名称:{{friuts.name}}</li>
                    <li>水果价格:{{friuts.price}}</li>
                </template>
            </ul>
        </div>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue">
    </script>
    <script>
        var app=new Vue({
            el:'#app',
            data:{
                // msg:"信息",
                // age:18,
                
                // imgUrl:"./timg.jpg",
                // Url:"http://baidu.com",
                // hasColor:true,
                // hasNum:false,
                // bgcolorCls:this.hasColor?'bgcolor':'',
                // colorCls:'forecolor',
                friuts:[
                    {name:'小苹果',price:80},
                    {name:'香蕉',price:55},
                    {name:'进口菠萝',price:90},
                    {name:'法国拉氏葡萄',price:100}
                ]
            },
            //过滤
            computed:{
                filterFriuts:function(){
                    return this.friuts.filter(function(friuts){
                        return friuts.name.match(/苹果/);
                    });
                },
                priceFriuts:function(){
                    return this.friuts.sort(function(a,b){
                        return b.price-a.price;
                    });
                }
            },
            filters:{
               
            },
            methods:{
                
            }
            
        })
        //更新
        app.friuts.push({
            name:'桃子',
            price:'66'
        });
    </script>
</body>
</html>